home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Scene Storm
/
Scene Storm - Volume 1.iso
/
coding
/
asm
/
pack
/
decrunchlib
/
declib_test.s
Wrap
Text File
|
1980-01-03
|
2KB
|
57 lines
_LVOAllocCrunchInfo = -30
_LVOFreeCrunchInfo = -36
_LVOGetCruncher = -42
_LVODecrunch = -48
ci_name = 4
ci_decdata = 8
ci_declen = 12
ci_packtype = 21
moveq #33,d0 ;version of library to open
lea DecName(pc),a1 ;ptr to libname
CallExec OpenLibrary ;open library
beq.s OpenDecErr ;did we open it okay?
move.l d0,DecBase ;save base address of library
TestPack move.l d0,a6 ;base of decrunch lib
CallOS AllocCrunchInfo ;allocate memory buffers
tst.l d0 ;did we succeed?
beq.s AllocDecErr ;exit if failed!
move.l d0,a4 ;a4=base address
move.l FilePtr(pc),a0 ;ptr to our filebuffer
move.l a0,(a4) ;save it into structure
move.l a4,a0 ;move structptr from a4 to a0
CallOS GetCruncher ;try to identify cruncher
tst.l d0 ;did we get one?
beq.s NotKnown ;nope, un identified!
move.l a4,a0 ;a0=struct
CallOS Decrunch ;decrunch it!
tst.l d0 ;did we succeed?
beq.s DecrunchErr ;nope, exit!
move.l ci_declen(a4),d0 ;unpacked length
move.l ci_decdata(a4),d2 ;unpacked buffer
move.l ci_name(a4),d3 ;name of cruncher
move.b ci_packtype(a4),d4 ;pack type (reloc/abs)
waity move.w $dff006,$dff180
btst #6,$bfe001
bne.s waity
NotKnown
DecrunchErr move.l DecBase(pc),a6 ;a6=base of decrunch lib
move.l a4,a0 ;a0=dec struct
CallOS FreeCrunchInfo ;free allocated decrunchbuffer
AllocDecErr move.l DecBase(pc),a1 ;base of decrunch lib to close
CallExec CloseLibrary ;close the library!
OpenDecErr moveq #0,d0 ;no error code
rts ;bye bye!!!!!
DecName dc.b 'decrunch.library',0
even
DecBase ds.l 1